package BankingApplication;

import java.awt.GridLayout;

import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;

public class AddAccountFrame extends JPanel 
{
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	String[] accountTypes = {"Checking", "Savings"};
	JComboBox<String> typeSelector = new JComboBox<String>(accountTypes);
	JLabel ownerAddLabel = new JLabel("Owner ssn");
	JTextField ownerAddField = new JTextField();
	JLabel startBalanceLabel = new JLabel("Starting Balance");
	JTextField startBalanceField = new JTextField();
	JLabel minBalanceLabel = new JLabel("Minimum balance");
	JTextField minBalanceField = new JTextField();
	
	
	public AddAccountFrame () 
	{
		JFrame accountFrame;
		accountFrame = makeAccountFrame();
		setFocusable(false);
		accountFrame.pack();
	}

	private JFrame makeAccountFrame()
	{
		JFrame accountFrame = new JFrame();
		
		
		// add labels and boxes to containerilo
		setLayout( new BoxLayout(this, BoxLayout.Y_AXIS));
		add(typeSelector);
		add(ownerAddLabel);
		add(ownerAddField);
		add(startBalanceLabel);
		add(startBalanceField);
		add(minBalanceLabel);
		add(minBalanceField);
		
		add(buttonLayout());
		accountFrame.add(this);
		return accountFrame;
	}


	private JPanel buttonLayout()
	{
		JPanel buttons = new JPanel();
		buttons.setLayout(new GridLayout(1, 2));
		JButton submitButton = new JButton("SUBMIT");
		JButton cancelButton = new JButton("CANCEL");
		buttons.add(submitButton);
		buttons.add(cancelButton);
		return buttons;
	}
}
